<template>
	<view class="goods-detail" :class="themeName">
		<!-- 轮播图 -->
		<goods-swiper :images="goodsInfo.goods_image" :video="goodsInfo.video" :video-cover="goodsInfo.video_cover" />

		<view class="act-desc p-30 flex row-between">
			<view class="price">
				<price :content="goodsInfo.sell_price" main-size="60rpx" minor-size="24rpx" color="rgba(74, 25, 0, 1)"
					:prefix="goodsInfo.price_symbol">
					<view slot="suffix" class="muted line-through m-l-12 xxs"
						v-show="pageCommon.show_market_price == 1">
						<price :content="goodsInfo.lineation_price" :prefix="goodsInfo.price_symbol"
							:line-through="true" color="rgba(74, 25, 0, 1)" v-if="Number(goodsInfo.lineation_price)" />
					</view>
				</price>
			</view>
			<view class="time-count-down flex-wrap">
				<view class="title m-b-10">{{$zhTran('距离活动结束仅剩：')}}</view>
				<count-down :time-end="actInfo.end_time2" separator-color="rgba(38, 38, 38, 1)"
					bg-color="rgba(250, 64, 52, 1)" />
			</view>
		</view>

		<view class="goods-body p-20">
			<!-- 商品基础信息 -->
			<view class="goods-info">
				<view class="flex row-between col-top">
					<view class="goods-name lg">{{ goodsInfo.name }}</view>
					<view class="sm lighter share flex col--center row-center" @click="shareGoods">
						<u-icon name="zhuanfa" size="30" color="rgba(74, 25, 0, 1)" />
						<text class="m-l-10">{{$zhTran('分享')}}</text>
					</view>
				</view>
				<view class="flex row-between col-center user-buy">
					<view class="flex col-center">
						<image :src="item" v-for="(item,idx) in actInfo.buy_avatar" :key="idx">
						</image>
						<view class="text m-l-5">{{$zhTran('等'+actInfo.buy_user+'人参与团购')}}</view>
					</view>
					<view class="flex row-between">
						<view>{{$zhTran('已抢'+goodsInfo.cgp_order_goods+'件')}}</view>
						<view class="line"></view>
						<view>{{$zhTran('仅剩'+ goodsInfo.total_stock +'件')}}</view>
					</view>
				</view>
			</view>

			<!-- S 优惠 -->
			<view class="nr discounts">
				<text class="muted">{{$zhTran('优惠')}}</text>
				<view class="xxs m-l-20 flex-1">
					<view class="flex" @tap="showCoupons = true">
						<u-tag :text="$zhTran('领券')" mode="plain" size="mini" class="m-r-20" :color="themeColor"
							:border-color="themeColor" />
						<block v-for="item in goodsCouponSpecs" :key="item">
							<view class="coupon-tag">{{ item }}</view>
						</block>
						<u-icon name="arrow-right" class="muted nr" style="margin-left: auto" />
					</view>
				</view>
			</view>
			<!-- Coupons Popup -->
			<u-popup v-model="showCoupons" mode="bottom" border-radius="14" :closeable="false"
				:safe-area-inset-bottom="true">
				<view class="coupons">
					<view class="coupons-header">
						<text>{{$zhTran('领券')}}</text>
						<u-icon name="close" color="#666666" @tap="showCoupons = false" />
					</view>

					<view class="coupons-main">
						<scroll-view :scroll-y="true" style="height: 700rpx; touch-action: none">
							<view class="coupons-item" v-for="item in goodsCouponList" :key="item.id">
								<coupon-card mode="get" :name="item.name" :money="item.money"
									:condition="item.condition" :time="item.effective_time" :scene="item.use_scene"
									:coupon-id="item.id" :gotten="!!item.is_receive" :prefix="goodsInfo.price_symbol"
									:button="{ name: $zhTran('领取'), theme: 'primary', disable: !!item.is_available }"
									@button="getCoupon" />
							</view>
							<u-empty v-if="!goodsCouponList.length" :text="$zhTran('暂无优惠券')"
								:src="$getImageUri('resource/image/shopapi/uniapp/empty/coupon_icon.png')"
								:icon-size="180" />
						</scroll-view>
					</view>
				</view>
			</u-popup>

			<view class="detail-tabs flex row-around m-t-20">
				<view :class="'tabs '+(current == 0?'selected':'')" @click="changeDetailTabs(0)">{{$zhTran('商品详情')}}
				</view>
				<view :class="'tabs '+(current == 1?'selected':'')" @click="changeDetailTabs(1)">{{$zhTran('商品属性')}}
				</view>
			</view>
			<!-- 商品介绍 -->
			<view class="detail m-t-20" v-show="current==0">
				<u-parse :html="goodsInfo.content" :show-with-animation="true"></u-parse>
			</view>
			<!-- 商品介绍 -->
			<view class="detail m-t-20" v-show="current==1">
				<u-attr :attr_data="goodsInfo.goods_attribute"
					v-if="goodsInfo.goods_attribute != undefined && goodsInfo.goods_attribute.length > 0">
				</u-attr>
				<view v-else>{{$zhTran('暂无属性信息')}}</view>
			</view>
		</view>

		<!-- 功能按钮组 -->
		<view class="functions" v-if="!sharePosterVisible && !showCoupons">
			<view class="cgp-btns">
				<view class="icon" @click="popCart">
					<u-badge type="error" :count="cartLength" :offset="[-7,-7]"></u-badge>
					<u-image :src="$getImageUri('resource/image/shopapi/uniapp/shopping-basket.png')" width="46rpx"
						height="48rpx"></u-image>
				</view>
				<view class="price flex col-center row-center" v-if="total_amount > 0">
					<price :content="total_amount" main-size="32rpx" minor-size="28rpx" color="#fff"
						:prefix="goodsInfo.price_symbol">
						<view slot="suffix" class="muted line-through m-l-20 xxs">
							<price :content="total_reduced" :prefix="$zhTran('已节省 -') + goodsInfo.price_symbol"
								:line-through="true" color="rgba(255, 255, 255, 1)" />
						</view>
					</price>
				</view>
				<view class="to-buy flex col--center row-center" @click="toBuy">{{$zhTran('去结算')}}</view>
			</view>

			<u-icon name="plus-circle-fill" size="90" color="rgba(255, 208, 0, 1)" class="btn-add" @click="addGoods"
				v-if="!cartShow">
			</u-icon>
		</view>

		<!-- 加载中 -->
		<u-mask :show="isChangeLoading" :mask-click-able="false" :custom-style="{ background: 'rgba(0, 0, 0, 0)' }">
		</u-mask>
		<view class="loading" v-if="isChangeLoading">
			<u-loading size="40" :color="themeColor"></u-loading>
			<view class="white m-t-20">{{$zhTran(' 加载中... ')}}</view>
		</view>

		<u-popup v-model="cartShow" mode="bottom" border-radius="14">
			<view class="cart-list">
				<view class="cart-header p-30 flex col-top row-between">
					<view class="choose">{{$zhTran('已选产品')}}<text>{{$zhTran('（共'+cartLength+'件）')}}</text></view>
					<view class="clear" @click="clearCart">
						<u-icon name="trash-fill" size="30" color="rgba(166, 166, 166, 1)"
							class="m-r-5" />{{$zhTran('清空')}}
					</view>
				</view>
				<view class="cart-goods p-30">
					<view class="cart-item flex u-border-bottom p-b-30 row-between col--center"
						v-for="item,idx in cartLists" :key="idx">
						<view class="goods-name">{{item.goods.goods_name}}</view>
						<view class="flex">
							<view class="price m-r-20">
								<price :content="item.goods_item.cgp_price" main-size="30rpx" minor-size="26rpx"
									color="rgba(250, 64, 52, 1)" :prefix="price_symbol">
								</price>
							</view>
							<u-number-box class=" number-box" :index="idx" :disabled-input="true" :inputWidth="60"
								v-model="buyList[item.item_id]" :min="0" bg-color="transparent" iconPlusColor="#fff"
								iconMinusColor="rgba(255, 208, 0, 1)" :diyPlusStyle="{
										bgColor:'rgba(255, 208, 0, 1)',
										color:'rgba(255, 255, 255, 1)',
										borderRadius:'100%',
										inputHeight:60
									}" :diyMinusStyle="{
										borderRadius:'100%',
										inputHeight:60,
										border:'1px solid rgba(255, 208, 0, 1)',
									}" @change="countChange($event, item.item_id)">
							</u-number-box>
						</view>
					</view>
				</view>
				<u-gap height="200"></u-gap>
			</view>
		</u-popup>

		<!-- 页面状态 -->
		<page-status :status="pageStatus">
			<template #error>
				<u-empty :text="pageErrorMsg" :src="$getImageUri('resource/image/shopapi/uniapp/empty/shop.png')"
					:icon-size="280"></u-empty>
			</template>
		</page-status>
		<u-back-top :scroll-top="scrollTop" :top="1000" :customStyle="{
			backgroundColor: '#FFF',
			color: '#000',
			boxShadow: '0px 3px 6px rgba(0, 0, 0, 0.1)',
			'z-index':99999999
		}">
		</u-back-top>


		<u-popup v-model="sharePosterVisible" mode="center" width="90%">
			<goods-poster ref="poster" :leader="options.leader" :goods="options.goods" :options="options"
				:activity="options.activity" @success="handleSuccess" @complete="handleComplete" />
			<view class="share-btns flex row-between m-t-20">
				<view class="share" @click="saveImageToOther">{{$zhTran('转发好友')}}</view>
				<view class="saveImg" @click="saveImageToAlbum">{{$zhTran('点击保存到相册')}}</view>
			</view>
		</u-popup>
		<loading-view v-show="loading"></loading-view>
	</view>
</template>

<script>
	import {
		apiCommunityGroupPurchaseCartAdd,
		apiCommunityGroupPurchaseCartDel,
		apiCommunityGroupPurchaseCartClear,
		apiCommunityGroupPurchaseCartLists, //商品列表
		apiCommunityGroupPurchaseCartCountChange, //商品数量改变
	} from "@/api/community_group_purchase";
	import {
		apiGoodsDetail,
		apiGoodsMarketing
	} from '@/api/goods'
	import {
		apiMnpCgpGoodsQrCode
	} from "@/api/app";
	import {
		baseURL,
		basePath
	} from '@/config/app'
	import {
		apiGetPage,
		apiCouponGet,
	} from '@/api/store'
	import {
		PageStatusEnum,
		OrderTypeEnum
	} from '@/utils/enum'
	import {
		mapGetters,
	} from 'vuex'
	import {
		apiCommunityGroupPurchaseLeaderActivityDetail,
	} from "@/api/community_group_purchase"
	import goodsPoster from "@/bundle2/pages/community_group_purchase/poster/goods_poster.vue";

	export default {
		name: 'GoodsDetail',
		components: {
			goodsPoster,
		},

		data() {
			return {
				// 页面状态
				pageStatus: PageStatusEnum['LOADING'],
				pagesData: [],
				pageErrorMsg: '', // 页面异常信息
				scrollTop: 0,
				percent: 0,
				goodsInfo: {}, // 商品信息
				goods_id: '', // 商品ID
				actInfo: {},
				cgp_id: '', // 团购活动ID
				leader_id: '', // 团长ID

				showGoodsSpec: false, // 商品规格: 显示 | 隐藏
				showCoupons: false, // 领券：显示 | 隐藏
				goodsCouponList: [], // 优惠券列表

				// 规格按钮组
				specButtonsGroups: {
					buy: {
						event: 'buy',
						text: this.$zhTran('立即购买'),
					},
					cart: {
						event: 'cart',
						text: this.$zhTran('加入购物车'),
					},
				},
				pageCommon: {},
				current: 0,
				buyList: [],
				cartLists: [],
				isChangeLoading: false,
				total_amount: 0,
				total_reduced: 0,
				cartShow: false,
				sharePosterVisible: false,
				options: {
					leader: {},
					goods: {},
					activity: {},
					qr_code: ''
				},
				imgPath: '',
				loading: false,
			};
		},

		computed: {
			...mapGetters(["isLogin"]),
			cartLength() {
				return this.cartLists.length
			},
			// 优惠券【视图】
			goodsCouponSpecs() {
				// 展示数量
				const COUNT = 2;
				const coupons = this.goodsCouponList;
				// 优惠券列表数量
				const Len = coupons.length;
				// 承载容器
				const payload = [];

				for (let i = 0; i < COUNT && i <= Len - 1; ++i) {
					const value = coupons[i]["condition"];
					payload.push(value);
				}

				return payload;
			},
		},

		methods: {
			// 获取装修页面
			getPage() {
				apiGetPage({
					type: 5,
					goods_id: this.goods_id,
				}).then((data) => {
					const {
						common,
						content
					} = this.$zhTran(data);

					this.pagesData = content;
					this.pageCommon = common;
					if (this.pageCommon.show_market_price == undefined)
						this.pageCommon.show_market_price = 1;
					if (this.pageCommon.show_goods_code == undefined)
						this.pageCommon.show_goods_code = 0;
					if (this.pageCommon.show_goods_model == undefined)
						this.pageCommon.show_goods_model = 0;
					if (this.pageCommon.show_goods_desc == undefined)
						this.pageCommon.show_goods_desc = 0;
					if (this.pageCommon.show_goods_price == undefined)
						this.pageCommon.show_goods_price = 1;
				});
			},
			changeDetailTabs(idx) {
				this.current = idx
			},

			// 领取优惠券
			getCoupon(id) {
				if (!this.isLogin) return this.$Router.push("/bundle2/pages/login/login");

				apiCouponGet({
						id,
					})
					.then(() => {
						this.$toast({
							title: this.$zhTran("领取成功"),
						});
						this.initMarketing();
					})
					.catch((err) => {
						console.log(err);
						// this.$toast({ title: '' })
					});
			},

			addGoods() {

				if (!this.isLogin) return this.$Router.push("/bundle2/pages/login/login");

				apiCommunityGroupPurchaseCartAdd({
						cgp_id: this.cgp_id,
						leader_id: this.leader_id,
						item_id: this.goodsInfo.item_id,
						goods_num: 1,
					})
					.then(() => {
						this.$set(this.buyList, this.goodsInfo.item_id, 1)
					})
					.catch((err) => {
						throw new Error(err);
					})
					.finally(() => {
						this.getCartList();
					});
			},
			// 商品数量的修改
			countChange({
				value
			}, item_id) {
				this.isChangeLoading = true;
				if (value > 0) {
					apiCommunityGroupPurchaseCartCountChange({
							cgp_id: this.cgp_id,
							leader_id: this.leader_id,
							item_id: item_id,
							goods_num: value,
						}).then(() => {
							this.$set(this.buyList, item_id, value)
						})
						.finally(() => {
							this.getCartList();
						});
				} else {
					apiCommunityGroupPurchaseCartDel({
							cgp_id: this.cgp_id,
							leader_id: this.leader_id,
							item_id: item_id,
						}).then(() => {
							this.buyList.splice(item_id, 1)
						})
						.finally(() => {
							this.getCartList();
						});
				}
			},
			clearCart() {
				apiCommunityGroupPurchaseCartClear({
						cgp_id: this.cgp_id,
						leader_id: this.leader_id,
					}).then(() => {
						this.buyList = []
					})
					.finally(() => {
						this.getCartList();
					});
			},
			// 获取购物车数据列表
			getCartList() {
				return apiCommunityGroupPurchaseCartLists({
					cgp_id: this.cgp_id,
					leader_id: this.leader_id,
				}).then((res) => {
					this.total_amount = res.total_amount;
					this.total_reduced = res.total_reduced
					this.cartLists = this.$zhTran(res.lists);
					this.isChangeLoading = false;
					this.buyList = [];
					if (this.cartLists.length > 0) {
						this.cartLists.forEach((item) => {
							this.$set(this.buyList, item.item_id, item.goods_num)
						})
					} else {
						this.popCart()
					}
					return Promise.resolve();
				});
			},
			popCart() {
				if (this.cartShow) {
					this.cartShow = false
				} else {
					if (this.cartLength > 0) this.cartShow = true
				}
			},
			toBuy() {
				if (this.cartLength == 0) {
					this.$toast({
						title: this.$zhTran("请添加商品"),
					});
					return
				}
				var that = this
				uni.navigateTo({
					url: "/bundle2/pages/community_group_purchase/order/goods_order",
					events: {
						reCountCarNum(res) {
							that.getCartList();
						}
					},
					success(res) {
						res.eventChannel.emit("receiveData", {
							cgp_id: that.cgp_id,
							leader_id: that.leader_id,
						});
					}
				});
			},

			// 初始化商品详情数据
			initGoodsDetail() {
				return new Promise((resolve, reject) => {
					apiGoodsDetail({
							id: this.goods_id,
							cgp_id: this.cgp_id,
						})
						.then((ndata) => {
							let data = this.$zhTran(ndata)
							this.goodsInfo = data;
							this.goodsInfo.item_id = data.spec_value_list[0].id
							console.log(data)
							resolve(data);
						})
						.catch((err) => {
							reject(err);
						});
				});
			},

			// 初始化优惠券
			initMarketing() {
				return new Promise((resolve, reject) => {
					apiGoodsMarketing({
							id: this.goods_id,
						})
						.then((data) => {
							this.goodsCouponList = this.$zhTran(data.coupon);
							resolve(data);
						})
						.catch((err) => {
							reject(err);
						});
				});
			},

			// 初始化活动详情数据
			initActivityDetail() {
				return new Promise((resolve, reject) => {
					apiCommunityGroupPurchaseLeaderActivityDetail({
							id: this.cgp_id,
						})
						.then((ndata) => {
							let data = this.$zhTran(ndata)
							this.actInfo = data;
							uni.setNavigationBarTitle({
								title: data.name,
							});
							console.log(data)
							resolve(data);
						})
						.catch((err) => {
							reject(err);
						});
				});
			},
			shareGoods() {
				this.loading = true
				this.options.leader = {
					user_info: {
						avatar: this.userInfo.avatar
					},
					name: this.userInfo.nickname
				}
				this.options.activity = {
					start_time: this.actInfo.start_time,
					end_time: this.actInfo.end_time,
					buy_avatar: this.actInfo.buy_avatar,
					buy_user: this.actInfo.buy_user,
				}
				this.options.goods = {
					goods_name: this.goodsInfo.goods_name,
					min_price: this.goodsInfo.sell_price,
					goods_image: this.goodsInfo.goods_image[0],
					cgp_order_goods: this.goodsInfo.cgp_order_goods,
					total_stock: this.goodsInfo.total_stock
				}
				this.options = this.$zhTran(this.options)
				this.getPoster()
			},
			async getPoster() {
				try {
					const res = await Promise.all([
						// #ifdef MP-WEIXIN
						apiMnpCgpGoodsQrCode({
							cgp_id: this.cgp_id,
							leader_id: this.leader_id,
							goods_id: this.goods_id
						})
						// #endif
					]);
					console.log('res', res)
					// #ifdef MP-WEIXIN
					this.options.qr_code = res[0]?.qr_code;
					// #endif
					console.log('options', this.options)
					this.$nextTick(() => {
						this.$refs.poster.drawCanvas();
					})
				} catch (e) {
					this.$toast({
						title: e,
					});
				} finally {
					this.loading = false
				}
			},
			handleSuccess(val) {
				console.log('handleSuccess', this.imgPath)
				this.imgPath = val;
				this.sharePosterVisible = true
				this.loading = false
			},
			handleComplete() {
				console.log('handleComplete')
				this.loading = false
			},
			saveImageToOther() {
				console.log('imgPath', this.imgPath)
				uni.showShareImageMenu({
					path: this.imgPath
				})
			},
			saveImageToAlbum() {
				// #ifndef H5
				uni.saveImageToPhotosAlbum({
					filePath: this.imgPath,
					success: (res) => {
						this.$toast({
							title: this.$zhTran("保存成功"),
						});
					},
					fail: (err) => {
						this.$toast({
							title: this.$zhTran("保存失败"),
						});
					},
				});
				// #endif
				// #ifdef H5
				this.$toast({
					title: this.$zhTran("请长按图片保存"),
				});
				// #endif
			},
		},
		onPageScroll(e) {
			const top = uni.upx2px(100)
			const {
				scrollTop
			} = e;
			this.percent = scrollTop / top > 1 ? 1 : scrollTop / top;
			this.scrollTop = scrollTop;
		},
		async onLoad() {
			const {
				cgp_id,
				goods_id,
				leader_id,
			} = this.$Route.query;
			this.cgp_id = cgp_id
			this.goods_id = goods_id
			this.leader_id = leader_id

			try {
				if (!goods_id) throw new Error(this.$zhTran("该商品不存在"));
				await this.getPage();
				// 活动详情数据
				await this.initActivityDetail()
				// 商品详情数据
				await this.initGoodsDetail();
				await this.getCartList()
				// 促销
				await this.initMarketing();
				this.pageStatus = PageStatusEnum["NORMAL"];
			} catch (err) {
				console.log(err);
				this.pageErrorMsg = err.message;
				this.pageStatus = PageStatusEnum["ERROR"];
			}
		},
	};
</script>

<style lang="scss" scoped>
	.goods-detail {
		padding-bottom: calc(100rpx + 20rpx + constant(safe-area-inset-bottom));
		padding-bottom: calc(100rpx + 20rpx + env(safe-area-inset-bottom));
	}

	.goods-body {


		.discounts {
			display: flex;
			padding: 24rpx;
			margin-top: 20rpx;
			background-color: #FFFFFF;

			.coupon-tag {
				box-sizing: border-box;
				position: relative;
				display: flex;
				justify-content: center;
				min-width: 140rpx;
				height: 36rpx;
				padding: 0 20rpx;
				border-radius: 4px;
				margin-right: 10rpx;
				color: #ffffff;

				@include background_color();

				&::before,
				&::after {
					position: absolute;
					top: 50%;
					transform: translateY(-50%);
					display: block;
					content: '';
					width: 10rpx;
					height: 10rpx;
					border-radius: 50%;
					background-color: #FFFFFF;
				}

				&::before {
					right: -5rpx;
				}

				&::after {
					left: -5rpx;
				}
			}
		}
	}

	.act-desc {
		height: 110rpx;
		background-color: rgba(255, 208, 0, 1);

		.time-count-down {
			.title {
				font-size: 24rpx;
				color: rgba(74, 25, 0, 1);
			}
		}
	}

	.goods-info {
		padding: 20rpx 24rpx;
		background-color: #FFFFFF;
		border-radius: 10rpx;

		.share {
			width: 134rpx;
			height: 60rpx;
			margin-right: -24rpx;
			border-radius: 30px 0 0 30px;
			background-color: rgba(255, 208, 0, 1);
			color: rgba(74, 25, 0, 1);
		}

		.goods-name {
			width: calc(100% - 134rpx);
			padding: 0 0 10rpx 0;
			font-weight: 500;
			font-size: 32rpx;
			color: rgba(38, 38, 38, 1);
		}

		.user-buy {
			padding-top: 12rpx;
			font-size: 26rpx;

			.text {
				float: left;
				color: rgba(166, 166, 166, 1);
			}

			.line {
				width: 1rpx;
				background-color: rgba(204, 204, 204, 1);
				height: 38rpx;
				margin: 0 10rpx;
			}

			image {
				float: left;
				margin-left: -15rpx;
				width: 46rpx;
				height: 46rpx;
				border-radius: 100%;
				border: 2px solid #ffffff;
				box-sizing: border-box;
			}
		}
	}

	.specification {
		display: flex;
		padding: 24rpx;
		margin-top: 20rpx;
		background-color: #FFFFFF;
		border-radius: 10rpx;
	}

	.detail-tabs {
		background-color: #FFFFFF;
		border-radius: 10rpx;
		padding: 20rpx 20rpx 0 20rpx;

		.tabs {
			color: rgba(34, 34, 34, 1);
			padding-bottom: 20rpx;
			font-size: 28rpx;

			&.selected {
				border-bottom: 8rpx solid rgba(255, 208, 0, 1);
			}
		}
	}

	.detail {
		border-radius: 10rpx;
		padding: 24rpx;
		margin-top: 20rpx;
		background-color: #FFFFFF;

		&-title {
			text-align: center;
			font-weight: 500;
			padding-bottom: 24rpx;
		}

		::v-deep image {
			vertical-align: top;
		}

		// #ifdef H5
		::v-deep img {
			vertical-align: top;
			display: inline;
		}

		// #endif
		// #ifdef MP-WEIXIN || APP-PLUS
		::v-deep ._img {
			vertical-align: top;
			display: inline;
		}

		// #endif
	}

	.functions {
		position: fixed;
		z-index: 9999999;
		left: 0;
		right: 0;
		bottom: 0;
		display: flex;
		align-items: center;
		height: calc(120rpx + constant(safe-area-inset-bottom));
		height: calc(120rpx + env(safe-area-inset-bottom));
		padding: 0 36rpx constant(safe-area-inset-bottom) 36rpx;
		padding: 0 36rpx env(safe-area-inset-bottom) 36rpx;

		.cgp-btns {
			width: 99%;
			height: 90rpx;
			margin-left: 1%;
			background-color: rgba(27, 15, 9, 1);
			position: relative;
			border-radius: 0 50rpx 50rpx 0;


			.icon {
				position: absolute;
				left: -18rpx;
				top: -20rpx;
				padding: 30rpx;
				background-color: rgba(255, 208, 0, 1);
				border-radius: 100%;
				border: 10rpx solid rgba(27, 15, 9, 1);
			}

			.price {
				position: absolute;
				left: 126rpx;
				height: 90rpx;
			}

			.to-buy {
				position: absolute;
				right: -1rpx;
				top: 0;
				height: 90rpx;
				padding: 0 30rpx;
				font-size: 28rpx;
				color: rgba(56, 56, 56, 1);
				border-radius: 0 50rpx 50rpx 0;
				background-color: rgba(255, 208, 0, 1);
			}
		}

		.btn-add {
			position: absolute;
			right: 36rpx;
			top: -207rpx;
		}
	}

	.coupons {
		background-color: #f6f6f6;

		&-header {
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 100rpx;
			padding: 0 30rpx;
			font-weight: 500;
			font-size: $-font-size-md;
			background-color: #FFFFFF;
		}

		&-main {
			padding: 20rpx;

			.coupons-item {
				&:nth-child(n+2) {
					margin-top: 20rpx;
				}
			}
		}
	}

	.share-btns {
		&>view {
			width: calc((100% - 30rpx) / 2);
			font-size: 26rpx;
			color: rgba(34, 34, 34, 1);
			border-radius: 10rpx;
			padding: 20rpx 0;
			background-color: rgba(255, 255, 255, 1);
			text-align: center;
		}

		.saveImg {
			background-color: rgba(255, 208, 0, 1);
		}
	}
</style>